using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter46
{
	/// <summary>
	/// Example03: Checking Lepton Numbers
	/// Use the law of conservation of lepton numbers 
	/// to determine which of the following decays schemes can occur:
	/// (A)\mu^{-} \rightarrow e^{-} + \bar{\nu}_{e} + \nu_{\mu}
	/// (B)\pi^{+} \rightarrow \mu^{+} + \nu_{\mu} + \nu_{e}
	/// </summary>
	public class Example03
	{
		public Example03()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Particle mu = new L.Particle();
			mu.MuonLeptonNumber = 1;
			L.Particle e = new L.Particle();
			e.ElectronLeptonNumber = 1;
			L.Particle nuebar = new L.Particle();
			nuebar.ElectronLeptonNumber = -1;
			L.Particle numu = new L.Particle();
			numu.MuonLeptonNumber = 1;
			if(mu.MuonLeptonNumber 
				== e.ElectronLeptonNumber + nuebar.ElectronLeptonNumber 
				+ numu.MuonLeptonNumber)
				result+="OK\r\n";
			else result+="NO\r\n";	

			L.Particle pi = new L.Particle();
			pi.MuonLeptonNumber = 0;
			pi.ElectronLeptonNumber = 0;
			L.Particle mup = new L.Particle();
			mup.MuonLeptonNumber = -1;
			L.Particle nue = new L.Particle();
			nue.ElectronLeptonNumber = 1;
	
			if(pi.ElectronLeptonNumber == mup.ElectronLeptonNumber 
				+ nue.ElectronLeptonNumber
				+ numu.ElectronLeptonNumber &
				pi.MuonLeptonNumber == mup.MuonLeptonNumber 
				+ nue.MuonLeptonNumber
				+ numu.MuonLeptonNumber)
				result+="OK\r\n";
			else result+="NO\r\n";	
		}
	}
}
